//
//  NSLock+NSLockExtend.m
//  etionMisc
//
//  Created by wu jingxing on 13-3-13.
//  Copyright (c) 2013年 GuangZhouXuanWu. All rights reserved.
//

#import "NSLockExtend.h"

@implementation NSLock (NSLockExtend)

-(void)lock:(void (^)())block
{
    [self lock];
    block();
    [self unlock];
}

-(void)lockBeforeDate:(NSDate*)date block:(void(^)())block
{
    [self lockBeforeDate:date];
    block();
    [self unlock];
}

@end

@implementation NSCondition (NSConditionExtend)

-(void)lock:(void (^)())block
{
    [self lock];
    block();
    [self unlock];
}

@end
